/*
 * @Company: Shanghai Jindoo Intelligent Technology Co., Ltd
 * @Description: 
 * @Version: 1.0
 * @Autor: Xingguang.wang
 * @Date: 2021-06-20 22:04:27
 * @LastEditors: Xingguang.wang
 * @LastEditTime: 2021-06-22 16:58:15
 */
#include "datadispwidget.h"

DataDispWidget::DataDispWidget(QString text, QString unit, QWidget *parent) : QWidget(parent)
{
    this->m_Text = text;
    this->m_Unit = unit;
    this->m_DispLevel = DISP_NORMAL;
    this->m_TitleLabel = new QLabel(this->m_Text, this);
    this->m_GroupBox = new QGroupBox(this);
    this->m_DataEdit = new QLineEdit("***", this);

    this->initView();
}

void DataDispWidget::setDispLevel(const uint &DispLevel)
{
    m_DispLevel = DispLevel;
}

void DataDispWidget::setData(const QVariant &Data)
{
    m_Data = Data;
}

void DataDispWidget::setZoom(const uint &Zoom)
{
    m_Zoom = Zoom;
}

void DataDispWidget::initView()
{
    QHBoxLayout *itemLay = new QHBoxLayout;
    QVBoxLayout *layout = new QVBoxLayout;

    itemLay->addWidget(this->m_TitleLabel, 3);
    itemLay->addWidget(this->m_DataEdit, 1);

    this->m_DataEdit->setAlignment(Qt::AlignRight);
    this->m_TitleLabel->setStyleSheet(createCustomStyleSheet("QLabel", 18, TITLE_STYLE, "#4b413f", 0, "#ffffff", 0));
    this->m_DataEdit->setStyleSheet(createCustomStyleSheet("QLineEdit", 18, NORMAL_STYLE, "#4b413f", 0, "#ffffff", 0));
    this->m_GroupBox->setStyleSheet(QString("QGroupBox{border:2px solid #79716b;border-radius:6px;background:#4b413f;}"));
    this->m_GroupBox->setLayout(itemLay);
    this->setFixedSize(258, 56);

    layout->addWidget(this->m_GroupBox);
    layout->setContentsMargins(0, 0, 0, 0);
    this->setLayout(layout);
}
